package com.gosophia.metadataEngine.action;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.gosophia.metadataEngine.dto.DataSourceInfoDto;
import com.gosophia.metadataEngine.ws.MetadataEngineWebService;
import com.opensymphony.xwork2.ActionSupport;

/**
 * 转入查看指定数据源下的元数据表页面
 * @author wangxinbing
 * @since 2011-5-6
 */
@Controller("ToMetadataTablePageByDataSourceInfoIdAction")
@Scope("prototype")
public class ToMetadataTablePageByDataSourceInfoIdAction extends ActionSupport{

	private Long dataSourceInfoId;
	
	private String dataSourceNameCN;
	
	@Autowired
	private MetadataEngineWebService metadataEngineWebService;

	public Long getDataSourceInfoId() {
		return dataSourceInfoId;
	}

	public void setDataSourceInfoId(Long dataSourceInfoId) {
		this.dataSourceInfoId = dataSourceInfoId;
	}
	
	public String getDataSourceNameCN() {
		return dataSourceNameCN;
	}

	public void setDataSourceNameCN(String dataSourceNameCN) {
		this.dataSourceNameCN = dataSourceNameCN;
	}

	public String execute(){
		DataSourceInfoDto dataSourceInfoDto = metadataEngineWebService.findDataSourceInfoById(dataSourceInfoId);
		dataSourceNameCN = dataSourceInfoDto.getName();
		return SUCCESS;
	}
}
